<template>
    <el-row>
        <el-col :span="10">
            <span style="margin-left: 20px; font-size: 26px">在线工作台</span>
            <el-button icon="el-icon-search" v-model="isCollapse" v-if="isCollapse" @click="isCollapse=false" circle></el-button>
            <el-button icon="el-icon-edit" v-model="isCollapse" v-else @click="isCollapse=true" circle></el-button>

        </el-col>
        <el-col :span="12">
            <el-menu
                default-active="1"
                class="el-menu-vertical-demo navigation"
                :collapse="isCollapse"
                @open="handleOpen"
                @close="handleClose">
                <el-submenu index="1">
                    <template slot="title">
                        <i class="el-icon-location"></i>
                        <span>我的主页</span>
                    </template>
                    <el-menu-item-group>
                        <template slot="title">分组一</template>
                        <el-menu-item index="1-1">选项1</el-menu-item>
                        <el-menu-item index="1-2">选项2</el-menu-item>
                    </el-menu-item-group>
                    <el-menu-item-group title="分组2">
                        <el-menu-item index="1-3">选项3</el-menu-item>
                    </el-menu-item-group>
                    <el-submenu index="1-4">
                        <template slot="title">选项4</template>
                        <el-menu-item index="1-4-1">选项1</el-menu-item>
                    </el-submenu>
                </el-submenu>

                <el-submenu index="2">
                    <template slot="title">
                        <i class="el-icon-menu"></i>
                        <span>我的应用</span>
                    </template>
                    <el-menu-item-group>
                        <el-menu-item index="2-1-1">学习专注</el-menu-item>
                    </el-menu-item-group>
                </el-submenu>

                <el-menu-item index="3">
                    <i class="el-icon-document"></i>
                    <span slot="title">我的文件</span>
                </el-menu-item>
                <el-menu-item index="4">
                    <i class="el-icon-setting"></i>
                    <span slot="title">我的配置</span>
                </el-menu-item>
            </el-menu>
        </el-col>
    </el-row>
</template>

<script>
export default {
    name: "navgation",
    data: function () {
        return {
            isCollapse: true
        }
    },
    methods: {
        handleOpen(key, keyPath) {
            console.log(key, keyPath);
        },
        handleClose(key, keyPath) {
            console.log(key, keyPath);
        }
    }
}
</script>

<style scoped>

.el-menu-vertical-demo:not(.el-menu--collapse) {
    width: auto;
    height: 100vh;
}

.navigation {
    /*width: 20%;*/
    width: 100%;
    height: 100vh;
    background: #73b9a2;
}

.el-col {
    margin: 0px !important;
    padding: 0px !important;
    width: 100%;
}

.el-row {
    margin: 0px !important;
    padding: 0px !important;
}
</style>